import React, {Component} from 'react';
// import {NavLink} from "react-router-dom";
import style from './Nav.module.css';
import {withRouter} from 'react-router-dom';

/*点击改变浏览器的路径*/
class Nav extends Component {

  static defaultProps = {
    viewList: []
  };

  render() {
    let {viewList} = this.props;
    return (
      <ul className={style.navList}>
        {
          viewList.map((item, index) => {
            return (<li key={item.title + index} onClick={() => {
              this.props.history.push(item.path);
            }}>
              {/*<NavLink to={item.path}>*/}
              {/*  {item.title}*/}
              {/*</NavLink>*/}
              {item.title}
            </li>)
          })

        }
      </ul>
    );
  }
}

Nav = withRouter(Nav);
export default Nav;
